import torch
from collections import OrderedDict

model_file = "./params/0bert.pt"
model_data = torch.load(model_file)

print(f"模型参数类型: {type(model_data)}")
print(f"包含的参数键: {list(model_data.keys())}")
print("\n详细参数信息:")

for key, value in model_data.items():
    print(f"\n参数名: {key}")
    print(f"数据类型: {type(value)}")
    print(f"设备位置: {value.device}")
    print(f"形状: {value.shape}")
    print(f"前5个值: {value.flatten()[:5]}")  # 对于权重矩阵，只显示前5个值
    print(f"requires_grad: {value.requires_grad}")

# 检查是否有缺失的键
required_keys = ['fc.weight', 'fc.bias']
missing_keys = [key for key in required_keys if key not in model_data]
if missing_keys:
    print(f"\n警告: 缺少以下参数: {missing_keys}")
else:
    print("\n所有必要参数都存在")